package com.march.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.GetMapping;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfiguration {

    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        ApiInfo apiInfo = new ApiInfoBuilder()
                .contact(new Contact( //配置swagger开发文档
                        "瑞吉外卖开发文档",
                        "https://www.baidu.com",
                        "2171487399@qq.com"))
                .title("Swagger框架学习文档")
                .description("RestAPI帮助文档")
                .version("1.1")
                .build();
        docket.apiInfo(apiInfo);
        docket.groupName("瑞吉外卖");
        docket.select()
                .apis(RequestHandlerSelectors.basePackage("com.march.controller"))//扫码指定的包
//              .apis(RequestHandlerSelectors.none()) //扫码指定的包
//              .apis(RequestHandlerSelectors.withMethodAnnotation(GetMapping.class)) //扫码指定的包
                .build();

        return docket;
    }
}
